﻿using ApiManage.Models.zyhModels;
using ApiManage.Service.MsSql.IService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

namespace ApiManage.Service.MsSql.Service
{
    public class WorkProductTypeService : BaseService, IWorkProductTypeService
    {

        public List<WorkProductType> GetList(Expression<Func<WorkProductType, bool>> where) => _zyhContext.WorkProductType.Where(where).ToList();
        public void Insert(WorkProductType param)
        {
            _zyhContext.WorkProductType.Add(param);
            _zyhContext.SaveChanges();
        }

        public void Update(WorkProductType param)
        {
            _zyhContext.WorkProductType.Update(param);
            _zyhContext.SaveChanges();
        }

        public void Delete(int id)
        {
            var role = _zyhContext.WorkProductType.FirstOrDefault(o => o.Id == id);
            role.Mark = 9;
            _zyhContext.SaveChanges();
        }
    }
}
